<template>
  <div class="flex">
    <div class="flex-grow">
      <div class="flex items-center">
        <el-radio v-model="pathModel" :label="0" size="large">年级总分</el-radio>
        <el-input type="textarea" :rows="3" v-model="gradetotal"></el-input>
      </div>
      <div class="flex items-center">
        <el-radio v-model="pathModel" :label="1" size="large">年级单科</el-radio>
        <el-input type="textarea" :rows="3" class="mt-2" v-model="gradesubject"></el-input>
      </div>
      <div class="flex items-center">
        <el-radio v-model="pathModel" :label="2" size="large">班级总分</el-radio>
        <el-input type="textarea" :rows="3" class="mt-2" v-model="classtotal"></el-input>
      </div>
      <div class="flex items-center">
        <el-radio v-model="pathModel" :label="3" size="large">班级单科</el-radio>
        <el-input type="textarea" :rows="3" class="mt-2" v-model="classsubject"></el-input>
      </div>
      <div class="flex items-center">
        <el-radio v-model="pathModel" :label="4" size="large">
          校级&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        </el-radio>
        <el-input type="textarea" :rows="2" class="mt-2" v-model="school"></el-input>
      </div>
      <el-button :loading="reportLoad" type="primary" class="mt-4" @click="onExport">
        导出报告
      </el-button>
    </div>
  </div>
</template>

<script setup>
import { onMounted, ref } from 'vue';
import { exportReport } from '@/api/report';

onMounted(() => {});

const gradetotal =
  'http://127.0.0.1:5503/grade-total-report.html?code=pd1sgzwairOIdS94q4rOPlNGe+rT9Q2bfDH9x2OY7Lk2aUp6csC9if23ZczJ6wUxllUrwBB2FWO06L09FiJXvoBVHz9Uckd+lraIWy4+UuY=';
const gradesubject =
  'http://127.0.0.1:5503/grade-subject-report.html?code=cVgHXstg5yHCcMno0485y1naePn9lcpU/0FnsAeKXerFgn/2jQwIufAzDrXmNSswWO29t1zcZxlC/3YSeHjDQ82pDJj3k5Lf5WH/isdZwNFbF32rapQj0aBOYrAIuPwN35KW+KMRbDjHDHtqVIrH0QRIvaZGRsN0v3L86j1wXc8=';
const classtotal =
  'http://127.0.0.1:5503/class-total-report.html?code=JF18UBj1yYjgxfMMLJx76lCFY/pGeaSFH0n5d7qwjgtjIn/eEGDXPkoDRXp6sIB+5pKaQ8nfpbHzscdSIb1FgpDhUZFYHRfezt85gWb5KTVxRvjKzh28qZz8kVYfzFUN9/Cbs/3nudXaVqrwBYty9EBDusyq56FtN6C+QQQFiw/UN/d0yldF2kTL1CgQazjiQzhJBagS+Wh/4G+1LSHG7A==';
const classsubject =
  'http://127.0.0.1:5503/class-subject-report.html?code=JF18UBj1yYjgxfMMLJx76lCFY/pGeaSFH0n5d7qwjgtjIn/eEGDXPkoDRXp6sIB+5pKaQ8nfpbHzscdSIb1FgpDhUZFYHRfezt85gWb5KTVxRvjKzh28qZz8kVYfzFUNSFHnVtM1ZtGUWyPxDPEKr0xl9aYUwVHisqDZ+t5lcwjcOItIg4m1OoTZ3HBEBTCSxen9xB5IOOPWr5E/DO8ZqL2q56QnWjv38BTcCouCw1U=';

const school =
  'http://127.0.0.1:5503//school-report.html?code=qYUTypwmq/7hxXkX9JB7Rz8vzBT1QnJtUwboe7Pqkfv7F8KvIj+b+QLcQYxfv8FTuxAoZhqLk5AG7oM8Q+JKmVDTT5RMEq4VUPOUGGLAgmggMTkgBddFpzxiJmTQ0bnWCcumlz6AnYlTVleQSZFr1A==';

const pathModel = ref(0);

const reportLoad = ref(false);
const onExport = () => {
  reportLoad.value = true;
  const url = [gradetotal, gradesubject, classtotal, classsubject, school][pathModel.value];
  exportReport({ url: url }).then(({ data }) => {
    reportLoad.value = false;
  });
};
</script>

<style lang="less" scoped></style>
